package org.airlink.persistence.tools {
	import flash.utils.ByteArray;
	
	import mx.utils.SHA256;

	public class Tools {
		public function Tools() {
		}
		
		public static function getStackMethod():Array {
			try {
				throw new Error();
			} catch(e:Error) {	
				var str:String = e.getStackTrace();
				var pattern:RegExp = /^\s+at\s+.*\(\)/gm; 
				var result:Array = str.match(pattern);
				trace("=========================");
				result.shift();
				trace(result.join("\n"));
			}
			return null;
		} 
		public static function getHashCode(obj:Object):String {
			var hash:String = "";
			var b:ByteArray = new ByteArray();
			b.writeObject(obj);
			b.position = 0;
			hash = SHA256.computeDigest(b);
			return hash;
		}
	}
}